<?php
@session_start();
$PurviewLevel=2;
$CheckChannelID=0;  
$PurviewLevel_Others="ModifyPwd";

require("../inc/common.inc.php");
require_once("Admin_ChkPurview.php");

?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<TITLE>铭讯EOS网站后台管理</TITLE>
<Meta name="Keywords" Content="济南网站建设 济南网站制作 山东网站建设 济南铭讯软件有限公司">
<Meta name="Description" Content="济南网站制作：铭讯软件专业服务优秀企业，致力于网站建、设网站推广、网络营销一体的全访位网络服务商">
<link rel="stylesheet" href="images/style.css" type="text/css">
</head>
<body>
<?php
		if ($actions=="setsave"){
			if($oldpass=="" or empty($oldpass)){
				$fun->popmassage("旧密码不能为空","","popback");
				exit();
			} 
			$oldpass=md5($oldpass);
			$rsdb=$db->excu("SELECT password FROM mx_members WHERE uid='".$_SESSION['mxadmin']['userid']."' and password='$oldpass' limit 1");
			$rsnum=$db->num_rows($rsdb);
			if($rsnum<=0){
				$fun->popmassage("旧密码不正确","","popback");
				exit();
			}
			if($password=="" or empty($password)){
				$fun->popmassage("新密码不能为空","","popback");
				exit();
			} 
			
			if($password2=="" or empty($password2)){
				$fun->popmassage("确认密码不能为空","","popback");
				exit();
			} 
			
			if($password!=$password2){
				$fun->popmassage("两次输入密码不一致","","popback");
				exit();
			} 
			$password=md5($password);

			$db->excu("update mx_members set password='$password' where  uid ='".$_SESSION['mxadmin']['userid']."' and password='$oldpass'");
			jump("操作成功","Admin_chpass.php",2);
			exit();
		}

require("mx_head.php");?>
<div class="right">
		<div class="xm2">
			<h1 class="fl">修改密码</h1>
			<div class="clear"></div>
		</div>
		<div class="xm2_b">
			<div class="height15"></div>
				<form name="form1" id="form1" action="Admin_chpass.php" method="post" onSubmit="return check_form();">
				  <table width="330" border="0" align="center" cellpadding="9" cellspacing="0">
                    <tr>
                      <td width="40%" align="right" class="font14">用 户 名：</td>
                      <td width="60%"><?php echo $_SESSION['mxadmin']['username'];?></td>
                    </tr>
                    <tr>
                      <td align="right" class="font14"> 旧 密 码：</td>
                      <td><input type="password" name="oldpass" id="oldpass" class="input2" /></td>
                    </tr>
                    <tr>
                      <td align="right" class="font14">新 密 码：</td>
                      <td><input type="password" name="password" id="password" class="input2" /></td>
                    </tr>
                    <tr>
                      <td align="right" class="font14">密码确认：</td>
                      <td><input type="password" name="password2" id="password2" class="input2" /></td>
                    </tr>
					<tr><td height="40" align="center" colspan="2">
					<input type="submit" name="sub" value="提交" class="button" />&nbsp;&nbsp;<input type="reset" name="r" value="重置" class="button2" /><input type="hidden" name="actions" value="setsave" />
					</td></tt>
				</table>
          </form>
			<div class="height15"></div>
		</div>
		<div class="clear"></div>
</div>
<script language="javascript">
function check_form(){

	if (!CheckLength("oldpass","旧密码")){
		return false;
	}
	
	if (!CheckLength("password","新密码")){
		return false;
	}
	else{
		if(document.form1.password.value.length<6){
			alert("新密码不能少于6个字符!"); 
			document.form1.password.focus();
			return false;
		}
	}
	if (!CheckLength("password2","密码确认")){
		return false;
	}
	else{
		if(document.form1.password2.value==document.form1.password.value){
	   
		}else{
			alert("两次输入的密码不同！");
			document.form1.password2.focus();
			return false;
		}
	}
}
</script>


<?php require("mx_foot.php");?>
</body>
</html>
